﻿
Imports System.Reflection
Imports std

Public Module _reflection
    Public Function invoke(ByVal m As MethodInfo, ByVal ps As vector(Of Object), ByRef rtn As Object) As Boolean
        If m Is Nothing Then
            Return False
        Else
            Try
                If ps Is Nothing Then
                    rtn = m.Invoke(Nothing, Nothing)
                Else
                    rtn = m.Invoke(Nothing, ps.data())
                End If
                Return True
            Catch ex As Exception
                raiseError("cannot invoke method " + m.Name() + ", ex " + ex.Message, errorHandle.errorType.exclamation)
                Return False
            End Try
        End If
    End Function
End Module
